fix(bundler): reject non-list 'catalogs' in bundle-catalogs.yml with a clean error#3623
Merged
mnriem merged 2 commits intoJul 22, 2026
Merged
Conversation
…a clean error
_merge_config guarded only 'if not catalogs: return', so a non-empty scalar
(catalogs: 5) passed through and raised a raw 'TypeError: int object is not
iterable' from the loop below — escaping the module's BundlerError error
contract. The sibling reader of the same file (commands_impl/catalog_config.py,
used by 'bundle catalog list') already raises an actionable BundlerError for the
identical mis-shape. Add the same isinstance(list) guard so both readers of
bundle-catalogs.yml agree.
Test: 'catalogs: 5' raises BundlerError('...must be a list...') (fails before:
raw TypeError).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds validation so malformed bundle catalog configuration raises BundlerError.
Changes:
- Validates that
catalogsis a list. - Adds a regression test for
catalogs: 5. - One issue remains: falsy non-list values bypass validation.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/bundler/models/catalog.py |
Adds catalog type validation. |
tests/contract/test_catalog_schema.py |
Tests a non-list scalar value. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Medium
mnriem
requested changes
Jul 22, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback
Address review: the isinstance guard sat after `if not catalogs: return`,
so falsy non-list values (`catalogs: false`, `0`, `''`, `{}`) hit the
early return and were silently accepted instead of raising the promised
BundlerError. Only an absent/None value means "nothing to merge".
Change the early return to `if catalogs is None`, mirroring the sibling
reader (commands_impl/catalog_config._read). An empty list stays valid
(the merge loop is a no-op). Add parametrized tests for the falsy
non-list cases and for the absent/empty-list no-op.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Fixed in 094f1bf: changed the early return to |
mnriem
self-requested a review
July 22, 2026 13:49
mnriem
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
_merge_config(the source-stack loader forbundle-catalogs.yml) guards only the falsy case:A non-empty scalar like
catalogs: 5(orcatalogs: true) passes the falsy check and then raises a rawTypeError: 'int' object is not iterablefrom the loop — escaping the module'sBundlerErrorerror contract.The sibling reader of the same file —
commands_impl/catalog_config.py(used byspecify bundle catalog list) — already raises an actionableBundlerError("Malformed catalog config … 'catalogs' must be a list …")for the identical mis-shape. So the two readers ofbundle-catalogs.ymldiverge.Fix
Add the same
isinstance(catalogs, list)guard, raising the same-shapedBundlerError. One file, ~3 lines (BundlerErroralready imported). Matches the shape-guard vein used acrosscatalogs.py,workflows/catalog.py, presets, and extensions.Test
catalogs: 5now raisesBundlerError(…must be a list…)— fails before (rawTypeError), passes after. Fulltest_catalog_schema.py(15) passes.🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.